
import org.apache.commons.beanutils.PropertyUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;

@Service
public class FmsSpecificationConfigServiceImpl implements FmsSpecificationConfigService  {

    @Resource
    private FmsSpecificationConfigMapper fmsSpecificationConfigMapper;

    /**
     * 获取 FmsSpecificationConfig 分页列表
     */
    @Transactional
    public IPage getFmsSpecificationConfigPagination( PaginationVo paginationVo, FmsSpecificationConfigQuery fmsSpecificationConfigQuery ) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<FmsSpecificationConfigEntity> lqs = new LambdaQueryWrapper();
        fmsSpecificationConfigMapper.selectPage(page, lqs);

        List<FmsSpecificationConfigEntity> record = page.getRecords();
        if( !ObjectUtil.isNotEmptyList(record)){
            return page;
        }
        return null;
    }


    /**
     * 获取 FmsSpecificationConfig 所有数据
     *
    */
    @Transactional
    public List<FmsSpecificationConfigEntity> getFmsSpecificationConfigAllList( FmsSpecificationConfigQuery fmsSpecificationConfigQuery ) throws Exception {

        LambdaQueryWrapper<FmsSpecificationConfigEntity> lqs = new LambdaQueryWrapper();
        List<FmsSpecificationConfigEntity> list = fmsSpecificationConfigMapper.selectList(lqs);
        return list;
    }


    /**
     * 获取 FmsSpecificationConfig 详情
    */
    @Transactional
    public FmsSpecificationConfigEntity getFmsSpecificationConfigDetail( Long id) throws Exception {

        FmsSpecificationConfigEntity fmsSpecificationConfig = fmsSpecificationConfigMapper.selectById(id);
        return fmsSpecificationConfig;
    }


    /**
     * 新增 FmsSpecificationConfig
     * */
    @Transactional
    public void addFmsSpecificationConfig(FmsSpecificationConfigVo fmsSpecificationConfigVo) throws Exception {

        FmsSpecificationConfigEntity fmsSpecificationConfig = new FmsSpecificationConfigEntity();
        ReflectionCopy.copyProperties( fmsSpecificationConfig, fmsSpecificationConfigVo );
        fmsSpecificationConfigMapper.insert(fmsSpecificationConfig);
        return;
    }


    /**
     * 更新 FmsSpecificationConfig
     * */
    @Transactional
    public void updateFmsSpecificationConfig( FmsSpecificationConfigVo fmsSpecificationConfigVo) throws Exception {

        if( fmsSpecificationConfigVo.getId() == null ){
            throw GlobalException.gen(10021, "id不存在");
        }
        FmsSpecificationConfigEntity fmsSpecificationConfig = new FmsSpecificationConfigEntity();
        ReflectionCopy.copyProperties( fmsSpecificationConfig, fmsSpecificationConfigVo );
        fmsSpecificationConfigMapper.updateById(fmsSpecificationConfig);
        return;
    }

    /**
     * 删除 FmsSpecificationConfig
     * */
    @Transactional
    public void batchRemoveFmsSpecificationConfig( List<Long> ids ) throws Exception {


        if( !ObjectUtil.isNotEmptyList(ids) ){
            throw GlobalException.gen(10011, "要删除的id不存在");
        }
        fmsSpecificationConfigMapper.deleteBatchIds(ids);
    }

}

      